﻿@model kxcxw.Data.Entities.PublichInformation
@using kxcxw.Data.Common
@{
    ViewBag.Title = "填写促销信息";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/createInfo_Q.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Content/datepicker/WdatePicker.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Content/HtmlEdit/xheditor-1.1.12-zh-cn.min.js")" type="text/javascript"></script>
<script type="text/javascript">
    var swfu;

    function Showdelete(id) {
        alert(id);
        document.getElementById(id).style.display = "none";
    }
    
</script>
<div class="page_content">
    <h2>
        实体店 - [@ViewData["categoryName"]] - 填写促销信息</h2>
    @Html.Partial("_StepCtrl", 3)
    @using (Html.BeginForm("Release", "Home", FormMethod.Post))
    {
        @Html.ValidationSummary(true)
        <fieldset>
            @Html.HiddenFor(model => model.ItemDeitalID)
            @Html.HiddenFor(model => model.InfoType)
            @Html.Hidden("ShopUrl", "http://www.kxcxw.com")
            <div class="fromcontent">
                <div class="wholetip clear">
                    <h3>
                        实体店促销信息</h3>
                </div>
                <div class="field">
                    <div class="editor-label">
                        <span>*</span>标 题：</div>
                    <div class="editor-field-long">
                        @Html.EditorFor(model => model.Title)
                    </div>
                    <div class="editor-field-validate">
                        @Html.ValidationMessageFor(model => model.Title)
                    </div>
                </div>
                <div class="field">
                    <div class="editor-label">
                        <span>*</span>详细地址：
                    </div>
                    <div class="editor-field-long">
                        @Html.EditorFor(model => model.Addres)
                    </div>
                    <div class="editor-field-validate">
                        @Html.ValidationMessageFor(model => model.Addres)
                    </div>
                </div>
                <div class="field">
                    <div class="editor-label">
                        类 别：
                    </div>
                    <div class="display-field">
                        @ViewData["categoryName"]
                    </div>
                </div>
                <div class="field">
                    <div class="editor-label">
                        促销方式：
                    </div>
                    <div class="editor-field">
                        @Html.DropDownListFor(model => model.PromotionType, (SelectList)ViewBag.PromotionType, new { id = "ddlmothed", onchange = "ddlmothedOnChange(this);" })
                    </div>
                    <div class="editor-label">
                        <span>*</span>原 价：
                    </div>
                    <div class="editor-field-small">
                        @Html.EditorFor(model => model.OriginalPrice)
                    </div>
                    <div id="zhekou">
                        <div class="editor-label">
                            <span>*</span>现 价：
                        </div>
                        <div class="editor-field-small">
                            @Html.EditorFor(model => model.PresentPrice)
                        </div>
                        <div class="editor-label">
                            <span>*</span>折 扣：
                        </div>
                        <div class="editor-field-small">
                            @Html.EditorFor(model => model.Discount)
                        </div>
                    </div>
                    <div id="gouzheng" style="display: none;">
                        <div class="editor-label">
                            <span>*</span>赠 品：
                        </div>
                        <div class="editor-field" style="width: 180px;">
                            @Html.EditorFor(model => model.Other)
                        </div>
                    </div>
                </div>
                <div class="field">
                    <div class="editor-label">
                        开始日期：
                    </div>
                    <div class="editor-field">
                        @Html.TextBoxFor(model => model.StartDate, new { @class = "Wdate", datatype = "date", onFocus = "WdatePicker({skin: 'whyGreen',isShowWeek:true,minDate:'%y-%M-%d',maxDate:'#F{$dp.$D(\\'EndDate\\')}'})" })
                        @Html.ValidationMessageFor(model => model.StartDate)
                    </div>
                    <div class="editor-label">
                        结束日期：
                    </div>
                    <div class="editor-field">
                        @Html.TextBoxFor(model => model.EndDate, new { @class = "Wdate", datatype = "date", onFocus = "WdatePicker({skin: 'whyGreen',isShowWeek:true,minDate:'#F{$dp.$D(\\'StartDate\\')}',maxDate:''})" })
                        @Html.ValidationMessageFor(model => model.EndDate)
                    </div>
                </div>
                <div class="field">
                    <div class="editor-label">
                        商家名：
                    </div>
                    <div class="editor-field-long">
                        @Html.EditorFor(model => model.BusinessName)
                    </div>
                </div>
                <div class="field">
                    <div class="editor-label">
                        联系电话：
                    </div>
                    <div class="editor-field">
                        @Html.EditorFor(model => model.Mobile)
                        @Html.ValidationMessageFor(model => model.Mobile)
                    </div>
                    <div class="editor-label">
                        联 系 人：
                    </div>
                    <div class="editor-field">
                        @Html.EditorFor(model => model.ContactPerson)
                        @Html.ValidationMessageFor(model => model.ContactPerson)
                    </div>
                    <div class="editor-label">
                        QQ或MSN：
                    </div>
                    <div class="editor-field">
                        @Html.EditorFor(model => model.IM)
                        @Html.ValidationMessageFor(model => model.IM)
                    </div>
                </div>
                <div style="height: auto;" class="field">
                    <div class="editor-label">
                        图 片：
                    </div>
                    <div class="editor-field-long">
                        @{Html.RenderPartial("_UpLoadPic", ""); }
                    </div>
                </div>
                <div style="height: auto; margin-top: 10px;" class="field">
                    <div class="editor-label">
                        详细信息：
                    </div>
                    <div class="editor-field-long">
                        @Html.TextAreaFor(m => m.Desception, new
                   {
                       @class = "xheditor {tools:'Blocktag,Fontface,FontSize,|," +
                           "Bold,Italic,Underline,Strikethrough,|,FontColor,BackColor,SelectAll,Removeformat,|," +
                           "Align,List,Outdent,Indent,|,Link,Unlink,Hr,Anchor,Table,|,Img,|,Fullscreen,Preview'," +
                           "skin:'default',width:'100%',height:'200px',cleanPaste:1," +
                           "upLinkUrl:'/Home/XhUpload',upImgUrl:'/Home/XhUpload?immediate=2',upFlashUrl:'XhEditor/XhUpload',upMediaUrl:'XhEditor/XhUpload' }"
                   })
                    </div>
                </div>
                <p>
                    <input type="submit" class="btn_mid" onclick="return valid()" value="发　　布" />
                </p>
            </div>
        </fieldset>
    }
</div>
<script type="text/javascript">
    var PromotionType = document.getElementById("ddlmothed");
    var xsId = "@(DataConstants.PanicBuying)";
    var StartDate = document.getElementById("StartDate");
    var EndDate = document.getElementById("EndDate");
    function valid() {
        var jPic = $("#thumbnails");
        var picContent = $.trim(jPic.html());
        if (!picContent) {
            alert("亲，添加几张图片吧，这样您的信息会被更多人看到。");
            return false;
        }
        else {
            if (jPic.children("div:visible.imgbox").length < 1) {
                alert("亲，您还是添加几张图片吧，这样您的信息会被更多人看到。");
                return false;
            }
        }

        var jDiscount = $("#Discount").val() * 1;
        if (jDiscount >= 9) {
            if (!confirm("只有9折以下的商品才能出现在主页，确定发布吗？")) {
                return false;
            }
        }
        if (PromotionType.value == xsId) {
            if (StartDate.value == "") {
                StartDate.className += " input-validation-error";
                return false;
            }
            if (EndDate.value == "") {
                EndDate.className += " input-validation-error";
                return false;
            }
        }
        else {
            StartDate.className = "Wdate";
            EndDate.className = "Wdate";
        }
    }
    function ddlmothedOnChange(obj) {
        //当前点击组件对象
        if (obj.value != xsId) {
            StartDate.className = "Wdate";
            EndDate.className = "Wdate";
        }
    }
</script>
